package handler

import (
	"github.com/zeromicro/go-zero/rest/httpx"
	"net/http"
	"selection-inventory/pkg/response"

	"selection-inventory/application/applet/internal/logic"
	"selection-inventory/application/applet/internal/svc"
)

func UploadPictureHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		l := logic.NewUploadPictureLogic(r.Context(), svcCtx)
		resp, err := l.UploadPicture(r)
		if err != nil {
			httpx.ErrorCtx(r.Context(), w, err)
		} else {
			response.Response(r, w, resp, err)
		}
	}
}
